package UnitTest.DataStructureTest.arrayAndListTest.findValueTest;

import Top100.GetMostValueofOrderArray;
import DataStructure.arrayAndList.findValue.GetMostValueofOrderArrayImpl_recursion;
import DataStructure.arrayAndList.findValue.GetMostValueofOrderArrayImpl;
import org.junit.Test;

/**
 * @author liujun
 * @version 1.0
 * @date 2020/8/20
 * @author—Email ljfirst@mail.ustc.edu.cn
 * @blogURL https://blog.csdn.net/ljfirst
 * @description 测试案例
 * 一个有序数组，比如[1,2,3,4,5,6,7],
 * 后面部分被替换到前面，比如[5,6,7,1,2,3,4],找出替换后的数组的最da值
 */
public class GetMaxValueofOrderArrayTest extends GetMostValueofOrderArrayTestData {


    @Test
    public void testgetMax_recursion() {
        test(new GetMostValueofOrderArrayImpl_recursion());
    }

    @Test
    public void testgetMax() {
        test(new GetMostValueofOrderArrayImpl());
    }

    public void test(GetMostValueofOrderArray find) {
        int value = find.getMaxValue(demoarray01);
        assert value == targetMax01;
        value = find.getMaxValue(demoarray011);
        assert value == targetMax011;
        value = find.getMaxValue(demoarray012);
        assert value == targetMax012;
        value = find.getMaxValue(demoarray02);
        assert value == targetMax02;
        value = find.getMaxValue(demoarray03);
        assert value == targetMax03;
        value = find.getMaxValue(demoarray04);
        assert value == targetMax04;
        value = find.getMaxValue(demoarray05);
        assert value == targetMax05;
        value = find.getMaxValue(demoarray06);
        assert value == targetMax06;
        value = find.getMaxValue(demoarray07);
        assert value == targetMax07;

        value = find.getMaxValue(demoarray08);
        assert value == targetMax08;
        value = find.getMaxValue(demoarray081);
        assert value == targetMax08;
        value = find.getMaxValue(demoarray082);
        assert value == targetMax08;
        value = find.getMaxValue(demoarray083);
        assert value == targetMax08;
        value = find.getMaxValue(demoarray084);
        assert value == targetMax08;

        value = find.getMaxValue(demoarray09);
        assert value == targetMax09;
        value = find.getMaxValue(demoarray10);
        assert value == targetMax10;
    }

}
